<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Packaging &middot; Theos</title>
	<meta name="viewport" content="initial-scale=1">
	<meta name="theme-color" content="#382b42">
	<link rel="stylesheet" type="text/css" href="assets/style-a3b52a608a1ac2b7ca829f2867add47324e7484c8280c2df12c5fc1d361022e1.css">
	<link rel="icon" href="assets/favicon-447ec328b50bd5d64f09e1f06fe07532f924f274bd5de6567a43690bf494c99a.svg" sizes="any" type="image/svg+xml">

</head>

<body>
	<header>
	<div class="container">
		<h1>
			<a href="#">
				<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 781 224">
					<title>Theos</title>
					<path d="M155.2 18.4H2.6v36.3H54V218h47.4V54.7h49.2l4.6-36.3zM263 60.2c-18 0-31.7 7.2-44 21V-.3l-45.6 4.6V218H219V113.2c8-12.4 16.3-19.6 26.4-19.6 8.6 0 14.4 4.3 14.4 20.4v104h45.5V106.3c0-29-16-46-42.4-46zm210 78.3c0 5-.4 11.8-1 16.4h-94.4c2.8 27 15.8 34.2 34.5 34.2 13 0 24-4.3 37-13.6l19 25.4c-15.2 12-35 21.4-59.6 21.4-51 0-77-33-77-80.7 0-45.6 25-82 71.5-82 43.5.3 70.5 29 70.5 78.5zm-44.7-11v-2c-.3-20.7-6.7-35-24.8-35-15.3 0-24 9.4-26.2 37h51zm137-67.3c46.7 0 75 30 75 81.5 0 49-28.3 81.2-75 81.2-46.3 0-74.8-30-74.8-82 0-49 28.2-81 74.8-81zm0 33.4c-18.4 0-27.6 14.7-27.6 47.8 0 34 9.2 48 27.6 48 18.5 0 27.7-14.6 27.7-47.7 0-34-9.2-48-27.7-48zm156-33.4c-38.7 0-62.6 20.4-62.6 46.6 0 23.6 15 39.2 45.2 47.8 27 7.8 32 11 32 21.4 0 9.2-8.8 14.4-22 14.4-15 0-29-6-41-15L651 200c15 14 37.4 23 64 23 38 0 68-18.6 68-50.3 0-27.4-17-40-47.3-48.7-27.3-8-31.4-11.6-31.4-19.7 0-7 6-11.5 18.5-11.5 13 0 25.7 4.3 37.5 11.8l17-25.6c-14-11.6-34-18.8-56-18.8z" fill="currentColor" fill-rule="evenodd"/>
				</svg>
			</a>
		</h1>

		<p class="header-tagline">A cross-platform build system for creating iOS, macOS, Linux, and Windows programs.</p>
	</div>
</header>


	<main>
		<div class="container">
			<div class="row flex-md-row-reverse">
				<article class="col-md-9">
					<h1>Packaging</h1>
					<p>Theos supports building for many common targets and packaging formats including:</p>

<h3 id="platforms">Platforms</h3>
<ul>
  <li>iOS</li>
  <li>macOS</li>
  <li>Linux</li>
  <li>Windows</li>
</ul>

<h3 id="formats">Formats</h3>
<ul>
  <li><code class="language-plaintext highlighter-rouge">.deb</code></li>
  <li><code class="language-plaintext highlighter-rouge">.ipa</code></li>
  <li><code class="language-plaintext highlighter-rouge">.pkg</code></li>
  <li><code class="language-plaintext highlighter-rouge">.rpm</code></li>
  <li>null (packaging w/o compiling anything)</li>
</ul>

<p>The most common configuration is targeting jailbroken iOS via .deb’s. As jailbroken iOS is bootstrapped by a Debian-esque platform, .deb’s follow many of the standard Debian Linux conventions.</p>

<h2 id="control-files">control files</h2>

<p>control files are required for Debian packages (.deb’s) and are configured for you by default when a project is initialized via the NIC.</p>

<p>The most commonly used fields include:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">Name:</code>
    <ul>
      <li>Name of the package</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Package:</code>
    <ul>
      <li>ID of the package</li>
      <li>Follows the format <code class="language-plaintext highlighter-rouge">com.name.package</code></li>
      <li>Choose wisely - don’t change this once your package has been released</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Author:</code>
    <ul>
      <li>Name of the package’s author</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Maintainer:</code>
    <ul>
      <li>Name of the package’s maintainer</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Version:</code>
    <ul>
      <li>The package’s version</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Depends:</code>
    <ul>
      <li>Package ID(s) for the package(s) that your package depends on</li>
      <li>Comma-separated list</li>
      <li>The version of the dependency can be specified by providing it in the format <code class="language-plaintext highlighter-rouge">(&gt;&gt; dep-ver)</code>, <code class="language-plaintext highlighter-rouge">(&gt;= dep-ver)</code>, <code class="language-plaintext highlighter-rouge">(= dep-ver)</code>, <code class="language-plaintext highlighter-rouge">(&lt;= dep-ver)</code>, or <code class="language-plaintext highlighter-rouge">(&lt;&lt; dep-ver)</code></li>
      <li>Note that there is a meta-package (i.e., an empty package with just a control file) provided on modern jailbreaks named <code class="language-plaintext highlighter-rouge">firmware</code> that can be placed in Depends: in order to restrict the iOS versions your package can be installed on
        <ul>
          <li>Example <code class="language-plaintext highlighter-rouge">Depends: firmware (&gt;= 12.0)</code></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Pre-Depends:</code>
    <ul>
      <li>This field is like Depends:, but it completes installation of the package(s) named before starting your package’s installation</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Recommends:</code>
    <ul>
      <li>Package ID(s) for the package(s) that your package can make use of, but that aren’t required</li>
      <li>Comma-separated list</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Provides:</code>
    <ul>
      <li>Package ID(s) for the package(s) your package is considered a drop-in replacement for</li>
      <li>Comma-separated list</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Conflicts:</code>
    <ul>
      <li>Package ID(s) for the package(s) your package cannot be installed alongside</li>
      <li>Comma-separated list</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Architecture:</code>
    <ul>
      <li>The target architecture of the installable package
        <ul>
          <li>Use <code class="language-plaintext highlighter-rouge">iphoneos-arm</code> for rootful iOS or <code class="language-plaintext highlighter-rouge">iphoneos-arm64</code> for rootless iOS</li>
        </ul>
      </li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Section:</code>
    <ul>
      <li>The section that your package should appear under in a package manager</li>
      <li><code class="language-plaintext highlighter-rouge">Tweaks</code> or <code class="language-plaintext highlighter-rouge">Utilities</code> are most common</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Description:</code>
    <ul>
      <li>The description for your package</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Icon:</code>
    <ul>
      <li>The local or remote path to your package’s icon (includes the file’s extension)</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">Depiction:</code>
    <ul>
      <li>A link to your package’s depiction</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">SileoDepiction:</code>
    <ul>
      <li>A link to your package’s <a href="https://developer.getsileo.app/native-depictions">native depiction</a> as used by package managers such as Sileo</li>
    </ul>
  </li>
</ul>

<p>Aside from a few jailbroken iOS-specific fields, the available fields can be found in <a href="https://www.debian.org/doc/debian-policy/ch-controlfields.html">Debian documentation</a>.</p>

<h2 id="maintainer-scripts">Maintainer scripts</h2>

<p>As with standard Debian packages, maintainer scripts can be added to your project to be run at various points throughout its (un)install cycle.</p>

<p>The scripts should be placed in $THEOS_LAYOUT_DIR and include:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">preinst</code>
    <ul>
      <li>A script to be run <em>prior</em> to your package’s installation</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">postinst</code>
    <ul>
      <li>A script to be run <em>after</em> your package’s installation</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">extrainst_</code>
    <ul>
      <li>A script to be run after your package’s installation, but only on installation and not on upgrade</li>
      <li>An iOS-specific extension created by Jay Freeman (saurik) - review <a href="https://theapplewiki.com/wiki/Dev:Packaging#extrainst">this explanation</a> to understand if you need to use <code class="language-plaintext highlighter-rouge">extrainst_</code> rather than <code class="language-plaintext highlighter-rouge">postinst</code></li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">prerm</code>
    <ul>
      <li>A script to be run <em>prior</em> to your package’s removal</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">postrm</code>
    <ul>
      <li>A script to be run <em>after</em> to your package’s removal</li>
    </ul>
  </li>
</ul>

<p><strong>Note:</strong> please ensure that your script’s hashbang is accurate. That is, if you use bashisms, please set the hashbang to either <code class="language-plaintext highlighter-rouge">#!/bin/bash</code> or <code class="language-plaintext highlighter-rouge">#!/usr/bin/env bash</code>. This has caused issues in the past when the default shell was changed.</p>

<h2 id="filter-property-list-plist">Filter property list (.plist)</h2>

<p>Building for jailbroken iOS also requires configuring for process injection via CydiaSubstrate (et al).</p>

<p>This filter is implemented as a property list that is installed alongside the .dylib(s) in the .deb. The property list is created for you when initializing a project via the NIC.</p>

<p>The filter can be for bundles, classes, and/or executables and is declared in the form of an xml/plist dictionary of arrays. Your tweak will only be loaded if the filter items specified are matched.</p>

<p>The format of said filter plist is as follows:</p>

<p>XML:</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>
<span class="cp">&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;</span>
<span class="nt">&lt;plist</span> <span class="na">version=</span><span class="s">"1.0"</span><span class="nt">&gt;</span>
<span class="nt">&lt;dict&gt;</span>
    <span class="nt">&lt;key&gt;</span>Filter<span class="nt">&lt;/key&gt;</span>
    <span class="nt">&lt;dict&gt;</span>
        <span class="nt">&lt;key&gt;</span>Bundles<span class="nt">&lt;/key&gt;</span>
        <span class="nt">&lt;array&gt;</span>
            <span class="nt">&lt;string&gt;</span>some.bundle.id<span class="nt">&lt;/string&gt;</span>
        <span class="nt">&lt;/array&gt;</span>
        <span class="nt">&lt;key&gt;</span>Executables<span class="nt">&lt;/key&gt;</span>
        <span class="nt">&lt;array&gt;</span>
            <span class="nt">&lt;string&gt;</span>executable-name<span class="nt">&lt;/string&gt;</span>
        <span class="nt">&lt;/array&gt;</span>
        <span class="nt">&lt;key&gt;</span>Classes<span class="nt">&lt;/key&gt;</span>
        <span class="nt">&lt;array&gt;</span>
            <span class="nt">&lt;string&gt;</span>class-name<span class="nt">&lt;/string&gt;</span>
        <span class="nt">&lt;/array&gt;</span>
    <span class="nt">&lt;/dict&gt;</span>
<span class="nt">&lt;/dict&gt;</span>
<span class="nt">&lt;/plist&gt;</span>
</code></pre></div></div>

<p><em>or</em></p>

<p>Text (i.e., NeXTSTEP format):</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
    Filter = {
        Bundles = (
            "some.bundle.id"
        );
        Executables = (
            "executable-name"
        );
        Classes = (
            "class-name"
        );
    };
}
</code></pre></div></div>

<p>For more information, see the <a href="https://theapplewiki.com/wiki/Dev:Cydia_Substrate#Filters">The Apple Wiki</a></p>

				</article>

				<aside class="col-md-3">
					<ul>
  
  <li>
    
      <a href="./index.html">Home</a>
    
    
  </li>
  
  <li>
    
      <a href="./Installation.html">Installation</a>
    
    
      <ul>
        
          <li>
            <a href="./Installation-iOS.html">
              iOS
              
            </a>
          </li>
        
          <li>
            <a href="./Installation-macOS.html">
              macOS
              
            </a>
          </li>
        
          <li>
            <a href="./Installation-Linux.html">
              Linux & Windows
              
            </a>
          </li>
        
          <li>
            <a href="./Upgrading-from-legacy-Theos.html">
              Upgrading from legacy Theos
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <span>Usage</span>
    
    
      <ul>
        
          <li>
            <a href="./Concepts.html">
              Concepts
              
            </a>
          </li>
        
          <li>
            <a href="./Configuration.html">
              Configuration
              
            </a>
          </li>
        
          <li>
            <a href="./Commands.html">
              Commands
              
            </a>
          </li>
        
          <li>
            <a href="./Packaging.html">
              Packaging
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <a href="./Features.html">Features</a>
    
    
      <ul>
        
          <li>
            <a href="./NIC.html">
              NIC
              
            </a>
          </li>
        
          <li>
            <a href="./NIC-Syntax.html">
              NIC Syntax
              
            </a>
          </li>
        
          <li>
            <a href="./dm.pl.html">
              dm.pl
              
            </a>
          </li>
        
          <li>
            <a href="./Swift.html">
              Swift
              
            </a>
          </li>
        
          <li>
            <a href="./Modules.html">
              Modules
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <span>Tweak Development</span>
    
    
      <ul>
        
          <li>
            <a href="./Logos.html">
              Logos
              
            </a>
          </li>
        
          <li>
            <a href="./Logos-Syntax.html">
              Logos Syntax
              
            </a>
          </li>
        
          <li>
            <a href="./logify.pl.html">
              Logify
              
            </a>
          </li>
        
          <li>
            <a href="./Logos-File-Extensions.html">
              File Extensions
              
            </a>
          </li>
        
          <li>
            <a href="./Logos-Hook-Splitting.html">
              Hook Splitting
              
            </a>
          </li>
        
          <li>
            <a href="https://orion.theos.dev/" target="_blank" rel="noopener">
              Orion
              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                  <path d="M1 11L11 1"/>
                  <path d="M2.5 1H11V9.5"/>
                </svg>
              
            </a>
          </li>
        
          <li>
            <a href="./Rootless.html">
              Rootless
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <span>Technical</span>
    
    
      <ul>
        
          <li>
            <a href="./Structure.html">
              Structure
              
            </a>
          </li>
        
          <li>
            <a href="./Variables.html">
              Variables
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <a href="./Help.html">Help</a>
    
    
      <ul>
        
          <li>
            <a href="./FAQ.html">
              FAQ
              
            </a>
          </li>
        
          <li>
            <a href="./Parallel-Building.html">
              Parallel Building
              
            </a>
          </li>
        
          <li>
            <a href="./arm64e-Deployment.html">
              arm64e Deployment
              
            </a>
          </li>
        
          <li>
            <a href="./License.html">
              License
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
  <li>
    
      <span>See also</span>
    
    
      <ul>
        
          <li>
            <a href="https://theapplewiki.com/" target="_blank" rel="noopener">
              The Apple Wiki
              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                  <path d="M1 11L11 1"/>
                  <path d="M2.5 1H11V9.5"/>
                </svg>
              
            </a>
          </li>
        
          <li>
            <a href="https://www.reddit.com/r/jailbreakdevelopers" target="_blank" rel="noopener">
              /r/jailbreakdevelopers
              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                  <path d="M1 11L11 1"/>
                  <path d="M2.5 1H11V9.5"/>
                </svg>
              
            </a>
          </li>
        
          <li>
            <a href="https://github.com/theiostream/theos-ref" target="_blank" rel="noopener">
              theos-ref (legacy docs)
              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                  <path d="M1 11L11 1"/>
                  <path d="M2.5 1H11V9.5"/>
                </svg>
              
            </a>
          </li>
        
      </ul>
    
  </li>
  
</ul>

				</aside>
			</div>
		</div>
	</main>

	<footer role="navigation">
	<ul class="footer-sub-links">
		<li><a href="./">Docs</a></li>
		<li><a href="./Help.html">Get Help</a></li>
		<li><a href="https://github.com/theos" rel="me">GitHub</a></li>
		<li><a href="https://procursus.social/@theos" rel="me">@theos@procursus.social</a></li>
		<li><a href="https://twitter.com/theosdev" rel="me">@theosdev</a></li>
		<li><a href="/discord">Discord</a></li>
	</ul>

	<div class="footer-legal">
		Copyright &copy; Theos.
		<br>
		<a href="https://github.com/theos/theos.dev">Edit on GitHub</a>
	</div>
</footer>

</body>
</html>
